<template>
  <div>
      <p @click="fun('zi')">子</p>
      <p @click="fun('fu')">父</p>
      <keep-alive>
          <component :is="con"></component>
      </keep-alive>
  </div>
</template>

<script>
import zi from './kongbai.vue'
import fu from './konngbai.vue'

export default {
    components:{
        zi,fu
    },
    data(){
        return {
            con:'zi'
        }
    },
    methods:{
        fun(obj){
            this.con = obj
        }
    }
}
</script>

<style>

</style>